<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<title>节点信息修改</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords"
	content="Modern Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
	
	 addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } 

</script>
<style type="text/css">
.myspan {
	color: red;
}
</style>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/jquery-ui.min.css">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- jQuery UI -->
<script src="js/jquery-ui.min.js"></script>
<!-- Nav CSS -->
<script type="text/javascript">
	function getWorkDate() {
		var starttime = document.getElementById("starttime");
		var endtime = document.getElementById("endtime");
		var startDate = starttime.value.substring(0, 10);
		var endDate = endtime.value;
		var sArr = startDate.split("-");
		var eArr = endDate.split("-");
		var sDate = new Date(sArr[0], sArr[1], sArr[2]);
		var eDate = new Date(eArr[0], eArr[1], eArr[2]);
		var result = (eDate - sDate) / (24 * 60 * 60 * 1000);
		var workdate = document.getElementById("workdate");
		workdate.innerHTML = result;
	}

	function validate() {
		if ($("#node_describe").val() == null
				|| $("#node_describe").val() == "") {
			$("#span_describe").text("请填写节点描述");
			return false;
		} else {
			$("#span_describe").text("√");
		}
		return true;
	}

	function fun() {
		if (validate()) {
			document.getElementById("noteForm").submit();
		}
	}
</script>
</head>
<body>
	<div id="wrapper">
		<!-- Navigation -->
		<div id="page-wrapper">

			<div class="xs">
				<div class="well1 white">
					<h3 align="center">节点信息修改</h3>
					<form id="noteForm" action="updateNode" method="post">
						<input type="hidden" name="node_id" value="${nodeDetail.id }" />
						<table class="table">
							<tr>
								<th>上级相关节点</th>
								<td><select name="node.relatedNode.id">
										<c:forEach items="${nodeList }" var="n">
											<c:choose>
												<c:when test="${n.id eq nodeDetail.relatedNode.id}">
													<option value="${n.id }" selected="selected">${n.node_result}</option>
												</c:when>
												<c:otherwise>
													<option value="${n.id }">${n.node_result}</option>
												</c:otherwise>
											</c:choose>
										</c:forEach>
								</select>
								</td>
							</tr>
							<tr>
								<th>节点版本</th>
								<td>${nodeDetail.node_version } <input type="hidden"
									name="node.node_version" value="${nodeDetail.node_version }" />
								</td>
								<th>节点专业类型</th>
								<td><select name="node.nodeType.id">
										<c:forEach items="${nodeTypeList}" var="nt">
											<c:choose>
												<c:when test="${nodeDetail.nodeType.id eq nt.id}">
													<option value="${nt.id }" selected="selected">${nt.node_type
														}</option>
												</c:when>
												<c:otherwise>
													<option value="${nt.id }">${nt.node_type }</option>
												</c:otherwise>
											</c:choose>
										</c:forEach>
								</select>
								</td>
							</tr>
							<tr>
								<th>节点所属生命周期</th>
								<td><select name="node.lc.id">
										<c:forEach items="${lifeCycleList }" var="lc">
											<c:choose>
												<c:when test="${nodeDetail.lc.id eq lc.id }">
													<option value="${lc.id }" selected="selected">${lc.name_lifecycle
														}</option>
												</c:when>
												<c:otherwise>
													<option value="${lc.id }">${lc.name_lifecycle }</option>
												</c:otherwise>
											</c:choose>
										</c:forEach>
								</select>
								</td>
								<th>节点生产来源</th>
								<td><select name="node.nodeFileSource">
										<c:forEach items="${fileList}" var="ns">
											<c:choose>
												<c:when test="${nodeDetail.nodeFileSource eq ns}">
													<option value="${ns }" selected="selected">${ns }</option>
												</c:when>
												<c:otherwise>
													<option value="${ns }">${ns}</option>
												</c:otherwise>
											</c:choose>
										</c:forEach>
								</select>
								</td>

							</tr>
							<tr>
								<th>是否考核节点</th>
								<td><c:if test="${nodeDetail.node_exam eq 0}">
										否
									</c:if> <c:if test="${nodeDetail.node_exam eq 1}">
										是
									</c:if> <input type="hidden" name="node.node_exam"
									value="${nodeDetail.node_exam }" />
								</td>
								<th>是否里程碑节点</th>
								<td><c:if test="${nodeDetail.node_milestone eq 0}">
										否
									</c:if> <c:if test="${nodeDetail.node_milestone eq 1}">
										是
									</c:if> <input type="hidden" name="node.node_milestone"
									value="${nodeDetail.node_milestone }" />
								</td>
							</tr>

							<tr>
								<th>节点关键度</th>
								<td>${nodeDetail.node_level } <input type="hidden"
									name="node.node_level" value="${nodeDetail.node_level }" />
								</td>
							</tr>

							<c:if test="${nodeDetail.node_starttime != null }">
								<tr>
									<th>节点要求开始时间</th>
									<td>${fn:substring(nodeDetail.node_starttime, 0, 10) } <input
										type="hidden" value="${nodeDetail.node_starttime }"
										id="starttime" />
									</td>
									<th>节点要求结束时间</th>
									<td><input type="date"
										value="${fn:substring(nodeDetail.node_endtime, 0, 10) }"
										id="endtime" onblur="getWorkDate()" name="node.node_endtime" />
										<span id="span_end" class="myspan"></span>
									</td>
								</tr>
								<tr>
									<th>节点需要的工日</th>
									<td><span id="workdate">${nodeDetail.node_workdays
											}</span>天 <input type="hidden" name="node.node_workdays"
										value="${nodeDetail.node_workdays }" />
									</td>
								</tr>
							</c:if>
							<tr>
								<th>节点成果形式</th>
								<td><input type="text" value="${nodeDetail.node_result }"
									name="node.node_result" />
								</td>
							</tr>
							<tr>
								<th>节点责任部门</th>
								<td>${nodeDetail.department.dept_name} <input type="hidden"
									name="node.department.id" value="${nodeDetail.department.id }" />
								</td>
							</tr>

							<tr>
								<th>节点描述</th>
								<td colspan="3"><textarea id="node_describe" cols="80"
										rows="2" name="node.node_describe">${nodeDetail.node_describe }</textarea>
									<span id="span_describe" class="myspan"></span>
								</td>
							</tr>

							<%-- <tr>
								<th>节点工作内容</th>
								<td colspan="3">
									<textarea cols="80" rows="2" name="node.node_workdetails">${nodeDetail.node_workdetails }</textarea>
								</td>
							</tr> --%>

							<tr>
								<th>节点备注</th>
								<td colspan="3"><textarea cols="80" rows="2"
										name="node.node_remark">${nodeDetail.node_remark }</textarea>
								</td>
							</tr>
						</table>
						<input type="hidden" value="${nodeDetail.firstplan.id }" name="" />
						<input type="hidden" value="${nodeDetail.firstplan.id }"
							name="node.firstplan.id" /> <input type="hidden"
							value="${nodeDetail.node_id }" name="node.node_id" /> <input
							type="hidden" value="${nodeDetail.node_lasttime }"
							name="node.node_lasttime" /> <input type="hidden"
							value="${nodeDetail.node_settime }" name="node.node_settime" />
						<input type="hidden" value="${nodeDetail.node_starttime }"
							name="node.node_starttime" />
						<div class="form-group" align="center">
							<input type="button" class="btn btn-primary" id="add_node_button"
								onclick="fun();" value="提交" /> <span id="add_node_span"
								class="myspan"></span> <input type="button"
								class="btn btn-primary" onclick="window.close()" value="关闭" />
						</div>
					</form>



				</div>
			</div>
		</div>
		<!-- /#page-wrapper -->
	</div>
	<!-- /#wrapper -->
</body>
</html>
